<h3> <%= @user.name %> </h3>
<%= link_to "Edit #{@user.name}", edit_admin_user_path(@user), class: 'tiny success button' %>
<div class='row'>
  <div class='four large-4 column'>
    <div class='panel callout'>
      <h4>Orders</h4>
      <% @user.finished_orders.sort_by{|o| o.completed_at}.reverse!.each do |order| %>
        <ul class='vertical-list'>
          <li><label>Order #</label><%= link_to order.number, edit_admin_fulfillment_order_path(order) %></li>
          <li><label>Price</label><%= order.first_invoice_amount.present? ? number_to_currency( order.first_invoice_amount ) : 'Not Charged yet.' %></li>
          <li><label>Completed at:</label><%= order.display_completed_at %></li>
          <li><label>Status:</label><%= order.state %></li>
        </ul>
      <% end %>
    </div>
  </div>
  <div class='four large-4 column', style='padding-left:0px;'>
    <div class='panel callout'>
      <h4>Shipments</h4>
      <% @user.shipments.each do |shipment| %>
        <ul class='vertical-list'>
          <li><label># of Items</label><%= shipment.order_items.count %></li>
          <li><label>Shipped at:</label><%= shipment.display_shipped_at %></li>
        </ul>
      <% end %>
    </div>
    <div class='panel callout'>
      <h4>Addresses</h4>
      <%= link_to "Add New Address", new_admin_user_datas_user_address_path(@user), class: 'small button' %>
      <ul class='vertical-list'>
        <% @user.addresses.each do |address| %>
            <li>
              <%= render :partial => '/shared/compact_address', :locals => {:shopping_address => address} %><br/>
              <% if address.active %>
                <%= link_to "edit", edit_admin_user_datas_user_address_path(@user, address), class: 'tiny button' %>
              <% end %>
            </li>
        <% end %>
      </ul>
    </div>
    <div class='panel callout'>
      <h4>Returns</h4>
      <% @user.return_authorizations.each do |rma| %>
        <ul class='vertical-list'>
          <li><label>Number:</label><%= rma.number %></li>
          <li><label>Order #:</label><%= rma.order.number %></li>
          <li><label>Amount:</label><%= number_to_currency rma.amount %></li>
          <li><label>CS Rep:</label><%= rma.author.try(:name) %></li>
        </ul>
      <% end %>
    </div>
  </div>
  <div class='four large-4 column', style='padding-left:0px;'>
    <div class='panel callout', style='margin-left:1px;'>
      <h4>Notes</h4>
      <% @user.comments.each do |comment| %>
        <hr/>
        <div>
          <h5><%= comment.author.try(:name) %></h5>
          <p><b>Note:</b> <%= comment.note %></p>
          <%= comment.commentable_type %><br/>
          <%= I18n.localize(comment.created_at, :format => :us_time) %>
        </div>
      <% end %>
      <%= link_to "New Comment", new_admin_customer_service_user_comment_path(@user), class: 'small button' %>
    </div>
  </div>
</div>
